package com.sgb.jicai.weight;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.sgb.jicai.R;

/**
 * Time:2021/7/21
 * AUTHOR:F_Q
 * Description: 供方发起
 */
public class SupplierContentProgress extends RelativeLayout {

    private TextView tvTwo;
    private ProgressBar progressbar;

    public SupplierContentProgress(Context context) {
        this(context,null);
    }

    public SupplierContentProgress(Context context, AttributeSet attrs) {
        this(context, attrs, 0);

    }

    public SupplierContentProgress(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        // 加载布局
        LayoutInflater.from(context).inflate(R.layout.supplier_content_progress, this);
        // 获取控件
        progressbar = findViewById(R.id.progressbar);
        tvTwo = findViewById(R.id.tv_two);
    }


    /**
     * 设置progressbar进度
     * @param progress
     */
    public void setProgressbar(int progress) {
        if (progress == 100){
            tvTwo.setBackgroundResource(R.mipmap.under_way);
        }else {
            tvTwo.setBackgroundResource(R.mipmap.under_un);
        }
        progressbar.setProgress(progress);
    }
}
